﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——采购退货单明细
    /// </summary>
    public class InBuyBackDetailConfiguration : EntityConfigurationBase<InBuyBackDetail>
    {
        /// <summary>
        /// 初始化一个<see cref="InBuyBackDetailConfiguration"/>类型的新实例
        /// </summary>
        public InBuyBackDetailConfiguration()
        {
             ToTable("buy_InBuyBackDetail");
             this.Property(p => p.InBuyBackId).HasColumnName("InBuyBackId");
             this.HasRequired(p => p.InBuyBack).WithMany(n => n.InBuyBackDetails).HasForeignKey(p => p.InBuyBackId).WillCascadeOnDelete(true);

             this.Property(p => p.InStoreDetailId).HasColumnName("InStoreDetailId");
             this.HasOptional(p => p.InStoreDetail).WithMany().HasForeignKey(p => p.InStoreDetailId).WillCascadeOnDelete(false);

             this.Property(p => p.ProductId).HasColumnName("ProductId");
             this.HasRequired(p => p.Product).WithMany().HasForeignKey(p => p.ProductId).WillCascadeOnDelete(false);

        }
    }
}
